<?php

    namespace yaliSDK\db;
    class DBQuery {
        private $table;//表
        private $where;//条件
        private $data;//数据
        private $field;//字段
        private $handleType;//链接类型
        private $order;//排序
        private $join;//多变链接
        private $limit;//限制结果数量
        private $group;//分组
        private $page;//分页
        private $alias;//别名
        private $expire;//过期时间
        private $start;//开始数
        private $stop;//截止数
        private $isPaginate;//分页
        private $condition;//条件

        public function __construct($table = '', $where = '', $data = '', $field = '', $handleType = 'set') {
            $this->table = $table;
            $this->where = $where;
            $this->data = $data;
            $this->field = $field;
            $this->handleType = $handleType;
        }

        /**
         * @param $data
         */
        public function setData($data): void {
            $this->data = $data;
        }

        /**
         * @param string $handleType
         */
        public function setHandleType(string $handleType): void {
            $this->handleType = $handleType;
        }

        /**
         * @param string $where
         */
        public function setWhere(string $where): void {
            $this->where = $where;
        }

        /**
         * @param string $field
         */
        public function setField(string $field): void {
            $this->field = $field;
        }

        /**
         * @param string $table
         */
        public function setTable(string $table): void {
            $this->table = $table;
        }

        public function getTable() {
            return $this->table;
        }

        public function getWhere() {
            return $this->where;
        }

        public function getData() {
            return $this->data;
        }

        public function getField() {
            return $this->field;
        }

        /**
         * @return string
         */
        public function getHandleType(): string {
            return $this->handleType;
        }

        /**
         * @param mixed $join
         */
        public function setJoin($join) {
            $this->join = $join;
        }

        /**
         * @return mixed
         */
        public function getJoin() {
            return $this->join;
        }

        /**
         * @return mixed
         */
        public function getLimit() {
            return $this->limit??1000;
        }

        /**
         * @param mixed $limit
         */
        public function setLimit($limit) {
            $this->limit = $limit;
        }

        /**
         * @return mixed
         */
        public function getGroup() {
            return $this->group;
        }

        /**
         * @param mixed $group
         */
        public function setGroup($group) {
            $this->group = $group;
        }

        /**
         * @param mixed $order
         */
        public function setOrder($order) {
            $this->order = $order;
        }

        /**
         * @return mixed
         */
        public function getOrder() {
            return $this->order;
        }

        /**
         * @param mixed $page
         */
        public function setPage($page) {
            $this->page = $page;
        }

        /**
         * @return mixed
         */
        public function getPage() {
            return $this->page;
        }

        /**
         * @param mixed $alias
         */
        public function setAlias($alias) {
            $this->alias = $alias;
        }

        /**
         * @return mixed
         */
        public function getAlias() {
            return $this->alias;
        }

        /**
         * @param mixed $expire
         */
        public function setExpire($expire) {
            $this->expire = $expire;
        }

        /**
         * @return mixed
         */
        public function getExpire() {
            return $this->expire;
        }

        /**
         * @param mixed $start
         */
        public function setStart($start) {
            $this->start = $start;
        }

        /**
         * @return mixed
         */
        public function getStop() {
            return $this->stop??-1;
        }

        /**
         * @return mixed
         */
        public function getStart() {
            return $this->start??0;
        }

        /**
         * @param mixed $stop
         */
        public function setStop($stop) {
            $this->stop = $stop;
        }

        /**
         * @param mixed $isPaginate
         */
        public function setIsPaginate($isPaginate) {
            $this->isPaginate = $isPaginate;
        }

        /**
         * @return mixed
         */
        public function getIsPaginate() {
            return $this->isPaginate??false;
        }

        /**
         * @return mixed
         */
        public function getCondition() {
            return $this->condition;
        }

        /**
         * @param mixed $condition
         */
        public function setCondition($condition) {
            $this->condition = $condition;
        }
    }